home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / DynSettingsMenu.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  6.1 KB  |  190 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. // Alias|Wavefront Script File
  19. // MODIFY THIS AT YOUR OWN RISK
  20. //
  21. // Creation Date:  13 April 1997
  22. // Author:         gf
  23. //
  24. //
  25. //  Procedure Name:
  26. //      DynSettingsMenu
  27. //
  28. //  Description:
  29. //        Create the DYNAMICS->Settings menu
  30. //
  31. //  Input Arguments:
  32. //      parent to parent the menu to.
  33. //
  34. //  Return Value:
  35. //      None.
  36. //
  37.  
  38. global proc DynSettingsMenu( string $parent )
  39. {
  40.     setParent -menu $parent;
  41.  
  42.     menuItem -label "Initial State" -subMenu true initialStateMenu;
  43.         menuItem -label "Set for Selected" 
  44.             -annotation "Set for Selected: Set initial state for the selected dynamic object"
  45.             -command "saveInitialStateForSelected" saveState;
  46.         menuItem -label "Set for All Dynamic" 
  47.             -annotation "Set for All Dynamic: Set initial state for all dynamics objects"
  48.             -command "evalEcho saveInitialState -all" saveStateAll;
  49.         setParent -menu ..;
  50.     menuItem -divider true;
  51.  
  52.     menuItem -label "Rigid Body Solver..." 
  53.              -annotation "Rigid Body Solver: Display the Rigid Body Solver Editor"
  54.              -command RigidBodySolver
  55.                 editRigidSolver;
  56.  
  57.     menuItem -divider true;
  58.  
  59.     string $menu = `menuItem -label "Current Rigid Solver"
  60.     -subMenu true -tearOff false
  61.         -annotation "Current Rigid Solver: Set the current rigid body solver"`;
  62.         menuItem -edit -postMenuCommand ( "createRigidSolverList " + $menu ) $menu;
  63.  
  64.     setParent -menu ..;
  65.  
  66.     menuItem -label "Create Rigid Body Solver" 
  67.              -annotation "Create Rigid Body Solver: Creates a new rigid body solver and makes it current"
  68.              -command "CreateRigidBodySolver"
  69.              createRigidSolver;
  70.  
  71.     setParent -menu ..;
  72.  
  73.     menuItem -divider true;
  74.  
  75.     menuItem -label "Set Rigid Body Interpenetration" 
  76.              -annotation "Set Rigid Body Interpenetration: Allow selected rigid bodies to interpenetrate"
  77.              -command "SetRigidBodyInterpenetration"
  78.              rigidBodyInterpenetration;
  79.  
  80.     menuItem -label "Set Rigid Body Collision" 
  81.              -annotation "Set Rigid Body Collision: Allow selected rigid bodies to collide"
  82.              -command "SetRigidBodyCollision"
  83.              rigidBodyCollison;
  84.  
  85.     menuItem -divider true;
  86.  
  87.     menuItem -label "Memory Caching" -subMenu true sceneCaching;
  88.         menuItem -label "Enable"
  89.                 -annotation "Enable Cache: Turn memory caching on for all selected particles and rigid bodies"
  90.                 -command "EnableMemoryCaching" enableCaching;
  91.  
  92.         menuItem -label "Disable"
  93.                 -annotation "Disable Cache: Turn memory caching off for all selected particles and rigid bodies"
  94.                 -command "DisableMemoryCaching" disableCaching;
  95.  
  96.         menuItem -divider true;
  97.         menuItem -label "Delete"
  98.                 -annotation "Delete Cache: Remove from memory the cache for all selected particles and rigid bodies"
  99.                 -command "DeleteMemoryCaching" deleteCache;
  100.     setParent -menu ..;
  101.  
  102.     menuItem -label "Create Particle Disk Cache"
  103.         -annotation "Create Particle Disk Cache: Write cache files to disk for current playback range"
  104.         -command   "CreateParticleDiskCache"
  105.         -dragMenuCommand "performDynamics 0 ParticleRenderCache 2"
  106.         -image   "bakeParticles.xpm"
  107.         particleRenderCacheItem;
  108.         menuItem -optionBox true 
  109.             -annotation "Particle Disk Cache Option Box"
  110.             -label "Particle Disk Cache Option Box"
  111.             -command "CreateParticleDiskCacheOptions"
  112.             particleRenderCacheDialogItem;
  113.  
  114.     menuItem -divider true;
  115.  
  116.     menuItem -label "Edit Oversampling or Cache Settings..."
  117.         -annotation "Edit the oversampling level or particle disk cache settings"
  118.         -command "EditOversamplingForCacheSettings"
  119.         editOversampling;
  120.  
  121.     setParent -menu ..;
  122.  
  123.     int $dynamicsIsLicensed = `licenseCheck -mode "edit" -type "fx"`;
  124.     if (!$dynamicsIsLicensed)
  125.     {
  126.          menuItem -edit -enable false eventEdWinItem;
  127.          menuItem -edit -enable false runupCacheMenu;
  128.  
  129.          // if it is desired to disable the particle render cache menu item
  130.          // when there is no fx edit license, add that line here.
  131.     }
  132.     global float $dynMaxFloatField = 500000;
  133.     global float $dynMinFloatField;
  134.     $dynMinFloatField = -500000;
  135. }
  136.  
  137.  
  138. global proc string createRigidSolverList( string $parent )
  139. //
  140. {
  141.     setParent -menu $parent;
  142.     menu -edit -deleteAllItems $parent;
  143.  
  144.     int    $i;
  145.     string $solverList[] = `ls -type rigidSolver`;
  146.     int    $solverCount  = size($solverList);
  147.  
  148.  
  149.     radioMenuItemCollection;
  150.     if ( $solverCount > 0 )
  151.     {
  152.         for ($i = 0; $i < $solverCount; $i++)
  153.         {
  154.             string $cmdString = "getAttr " + $solverList[$i] + ".current";
  155.  
  156.             int $current = eval( $cmdString );
  157.  
  158.             $cmdString = "setAttr " + $solverList[$i] + ".current 1";
  159.  
  160.             string $menu = "menu" + $solverList[$i];
  161.  
  162.                menuItem -label $solverList[$i] -radioButton $current -command $cmdString $menu;
  163.         }
  164.     }
  165.     else
  166.     {
  167.           menuItem -label "No rigid solvers found";
  168.     }
  169.  
  170.     return 1;
  171. }
  172.  
  173. global proc callRunup()
  174. //
  175. //    Call runup -cache and print message for user.
  176. //
  177. {
  178.        evalEcho("runup -cache"); 
  179.        print("// Runup and cache to current frame completed for all particles and rigid bodies.\n");
  180. }
  181.  
  182. global proc callDynCache()
  183. //
  184. //    Call dynCache and print message for user.
  185. //
  186. {
  187.         evalEcho("dynCache"); 
  188.         print("// Cached all particle and rigid body states for current frame.");
  189. }
  190.